package com.neusoft.resturant.service.impl;


import com.neusoft.resturant.entity.District;
import com.neusoft.resturant.mapper.DistrictMapper;
import com.neusoft.resturant.service.IDistrictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DistrictServiceImpl implements IDistrictService {
    @Autowired
    private DistrictMapper districtMapper;

    @Override
    public List<District> getParent(String parent) {
        List<District> list = districtMapper.findByParent(parent);
        for (District value : list) {
            value.setId(null);
            value.setParent(null);
        }
        return list;
    }

    @Override
    public String getNameByCode(String code) {
       return districtMapper.findNameByCode(code);
    }


}
